<?php
include 'user_detail_lib.php';
$b_Menu_Closed = true;

$a_css_files = array (
    array ( 'path' => 'plugins/bootstrap-fileupload/bootstrap-fileupload.css' ),
    array ( 'path' => 'plugins/chosen-bootstrap/chosen/chosen.css' ),
    array ( 'path' => 'plugins/jquery-ui/jquery-ui-1.10.1.custom.min.css' ),
    array ( 'path' => 'plugins/bootstrap-modal/css/bootstrap-modal.css' ),
    array ( 'path' => 'css/pages/nh-user-detail.css' ),
);

$a_js_files = array (
    array ( 'path' => 'plugins/bootstrap-fileupload/bootstrap-fileupload.js' ),
    array ( 'path' => 'plugins/chosen-bootstrap/chosen/chosen.jquery.min.js' ),
    array ( 'path' => 'plugins/jquery-validation/dist/jquery.validate.min.js' ),
    array ( 'path' => 'plugins/bootstrap-modal/js/bootstrap-modal.js' ),
    array ( 'path' => 'plugins/bootstrap-modal/js/bootstrap-modalmanager.js' ),
    array ( 'path' => 'scripts/nh-user-detail.js' ),
);

$a_js_class[] = 'User_Detail_Loader.init();';

// <editor-fold defaultstate="collapsed" desc="Get Data">
if ($f_userid == '') { raise_error('No ID.'); }

$db_query  = db_get_query($a_tablecolumns_namhoa_user) . " where userid =  '$f_userid' limit 1";
$db_result = db_query($db_conn, $db_query);

if ( !($d_user = db_fetch($db_result))) { raise_error('Select none.'); }

if (substr($d_user->eucharist_date   , 0, 4) < 1950 ) { $d_user->eucharist_date      = ''; }
if (substr($d_user->confirmation_date, 0, 4) < 1950 ) { $d_user->confirmation_date   = ''; }

$a_user_dear = $a_user_brother = $a_user_class = array();

// <editor-fold defaultstate="collapsed" desc="Get Dear">
$db_query  = db_get_query($a_tablecolumns_namhoa_user_dear) . " where userid =  '$f_userid'";
$db_result = db_query($db_conn, $db_query);

while ($d_row = db_fetch($db_result)) {
    $a_user_dear[] = $d_row;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Get Brothers">
if ($d_user->gencode) {
    
    $db_query  = "
        select  userid, saint, username, birthday
        from    user
        where   gencode = '$d_user->gencode' and userid <> '$f_userid'
        order by birthday desc";
    $db_result = db_query($db_conn, $db_query);

    while ($d_row = db_fetch($db_result)) {
        $a_user_brother[$d_row->userid] = $d_row;
    }
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Get Classes - Course">
$db_query  = db_get_query($a_tablecolumns_namhoa_user_class) . " where userid =  '$f_userid' order by course";
$db_result = db_query($db_conn, $db_query);

while ($d_row = db_fetch($db_result)) {
    
    if ($d_row->course == $a_KhoaHoc_Info['start_year']) {
        $d_user->classid = $d_row->classid;
        $d_user->team    = $d_row->team;
        $d_user->level   = $d_row->level;
        $d_user->crew    = $d_row->crew;
        $d_user->course  = $d_row->course;
    }

    $a_user_class[$d_row->classid] = $d_row;
}
// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Get location">
$db_query  = "
        select  location, note
        from    room
        where   team = '$d_user->team' and level = '$d_user->level' and crew = '$d_user->crew'
        limit   0, 1";
$db_result = db_query($db_conn, $db_query);

if ($d_row = db_fetch($db_result)) {
    
    $d_user->location = $d_row->location;
    $d_user->roomnote = $d_row->note;
}
// </editor-fold>

// </editor-fold>

// <editor-fold defaultstate="collapsed" desc="Set Permission">
$a_tmp_permission = array();
if ($s_UserID == $f_userid) {
    $a_tmp_permission = array(
        'update-profile',
        'update-password',
        'delete-profile',
        'insert-dears',
        'update-dears',
        'delete-dears',
        'insert-brother',
        'delete-brother',
        'update-profile-image',
    );
}

$a_permission = get_passport_action_from_module($db_conn, array('DANH_SACH'));
$a_permission = array_merge($a_tmp_permission, $a_permission);
// </editor-fold>

include 'lib_head.php';
?>
<div id="ajax-modal" class="modal hide fade" tabindex="-1"></div>
<div class="row-fluid profile">
    <div class="tab-pane row-fluid active" id="tab_1_1">
        <ul class="unstyled profile-nav span3">
            <li><img src="user_image.php?action=download-image&amp;userid=<?=$f_userid?>"/></li>
            <li>
                <a>
                    <i class="icon-calendar"></i> <?=namhoa_date($d_user->birthday)?>
                    <?php if ($d_user->usercrew) : ?>
                    <span><?=$a_PhanBan[$d_user->usercrew]?></span>
                    <?php endif; ?>
                </a>
            </li>
            <?php if ($d_user->mobile) : ?>
            <li><a><i class="icon-phone"></i> <?=$d_user->mobile?></a></li>
            <?php endif; ?>
            <?php if ($d_user->phone) : ?>
            <li><a><i class="icon-phone"></i> <?=$d_user->phone?></a></li>
            <?php endif; ?>
            <?php if ($d_user->address) : ?>
            <li><a><i class="icon-map-marker"></i> <?=$d_user->address?></a></li>
            <?php endif; ?>
            <?php if ($d_user->team) : ?>
            <li>
                <a href="user_detail_diary.php?userid=<?=$f_userid?>&course=<?=$d_user->course?>">
                    <i class="icon-star"></i> 
                    Khóa <?=$d_user->course?> - 
                    <?= isset($a_Nganh       [$d_user->team      ]) ? '   ' . $a_Nganh   [$d_user->team ] : '' ?>
                    <?= isset($a_Cap      [$d_user->level     ]) ? ' - ' . $a_Cap  [$d_user->level] : '' ?>
                    <?= isset($a_Doi       [$d_user->crew      ]) ? ' - ' . $a_Doi   [$d_user->crew ] : '' ?>
                    <span><i class="icon-trophy"></i></span>
                </a>
            </li>
            <?php endif; ?>
        </ul>
        <div class="span9">
            <div class="row-fluid">
                <div class="profile-info form-section">
                    <h1><?=$d_user->saint?> <?=$d_user->username?></h1>
                </div>
            </div>
            <!--end row-fluid-->
            <div class="tabbable tabbable-custom tabbable-custom-profile">
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#base-info" data-toggle="tab">Thông Tin Cá Nhân</a></li>
                    <li><a href="#dear-info" data-toggle="tab">Người Thân</a></li>
                    <li><a href="#diary-info" data-toggle="tab">Lược Sử Học Tập</a></li>
                    <li><a href="#update-info" data-toggle="tab">Cập Nhật</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane profile-classic active" id="base-info">
                        <ul class="unstyled inline">
                            <li class="span4"><span>Mã Số:</span> <?=$f_userid?></li>
                            <li class="span4"><span>Giới Tính:</span> <?=@$a_GoiTinh[$d_user->gender]?></li>
                            <li class="span4"><span>Phân Loại:</span> <?=$a_Loai_TaiKhoan[$d_user->usertype]?></li>

                            <?php if ($d_user->location) : ?>
                            <li class="span4">
                                <span>Vị Trí Học:</span>
                                <?=$d_user->location?>
                                <i><?= $d_user->roomnote ? ' - Ghi Chú: ' . $d_user->roomnote : ''?></i>
                            </li>
                            <?php endif; ?>
                            <?php if (namhoa_date($d_user->baptism_date)) : ?>
                            <li class="span4"><span>Rửa Tội:</span> <?=namhoa_date($d_user->baptism_date)?></li>
                            <?php endif; ?>
                            <?php if (namhoa_date($d_user->eucharist_date)) : ?>
                            <li class="span4"><span>Rước Lễ:</span> <?=namhoa_date($d_user->eucharist_date)?></li>
                            <?php endif; ?>
                            <?php if (namhoa_date($d_user->confirmation_date)) : ?>
                            <li class="span4"><span>Thêm Sức:</span> <?=namhoa_date($d_user->confirmation_date)?></li>
                            <?php endif; ?>   
                            <?php if ($d_user->email) : ?>
                            <li class="span4"><span>Email:</span> <?=$d_user->email?></li>
                            <?php endif; ?>
                            <?php if ($d_user->note) : ?>
                            <li class="span4"><span>Ghi Chú:</span> <?=$d_user->note?></li>
                            <?php endif; ?>    
                        </ul>
                    </div>
                    <!--tab-pane-->
                    <div class="tab-pane profile-classic" id="dear-info">
                        <div class="portlet-body">
                            <table class="table table-striped table-bordered table-advance table-hover">
                                <thead>
                                    <tr>
                                        <th class="hidden-phone">Mối Quan Hệ</th>
                                        <th>Tên Thánh - Họ và Tên</th>
                                        <th class="hidden-phone">Địa Chỉ</th>
                                        <th>ĐTDĐ</th>
                                        <th class="hidden-phone">ĐT Nhà</th>
                                        <th>
                                            <?php if (in_array('insert-dears', $a_permission)) { ?>
                                            <a class="btn green" id="modal_ajax_btn_add_dears" href="#" userid="<?=$f_userid?>" ><i class="icon-plus"></i> Thêm</a>
                                            <?php } ?>
                                        </th>
                                    </tr>
                                </thead>
                                <?php
                                if (!empty($a_user_dear)) :
                                    foreach ($a_user_dear as $o_value) {
                                ?>
                                <tbody>
                                    <tr>
                                        <td class="hidden-phone"><?=@$a_MoiQuanHe[$o_value->relationship]?></td>
                                        <td><?=$o_value->saint?> <?=$o_value->dearname?></td>
                                        <td class="hidden-phone"><?=$o_value->address?></td>
                                        <td><?= $o_value->mobile?></td>
                                        <td class="hidden-phone"><?=$o_value->phone?></td>
                                        <td>
                                            <?php if (in_array('update-dears', $a_permission)) { ?>
                                            <a class="btn blue-stripe modal_ajax_btn_update_dears" dearid="<?=$o_value->dearid?>" href="#"><i class="icon-remove icon-pencil"></i> Sửa</a>
                                            <?php } ?>
                                            <?php if (in_array('delete-dears', $a_permission)) { ?>
                                            <a class="btn red-stripe" href="javascript://" onclick="namhoa.single_delete('user_detail_execute.php?action=delete-dears&amp;dearid=<?=$o_value->dearid?>');"><i class="icon-remove icon-white"></i> Xóa</a>
                                            <?php } ?>
                                        </td>
                                    </tr>
                                </tbody>
                                <?php }
                                endif;?>
                            </table>
                        </div>
                        <h3 class="form-section" style="padding-top: 20px">Anh/Chị Em</h3>
                        <div class="portlet-body">
                            <table class="table table-striped table-bordered table-advance table-hover">
                                <thead>
                                    <tr>
                                        <th>Mã Số</th>
                                        <th>Tên Thánh - Họ và Tên</th>
                                        <th>Ngày Sinh</th>
                                        <th>
                                            <?php if (in_array('insert-brother', $a_permission)) { ?>
                                            <a class="btn green" id="modal_ajax_btn_add_brother" href="#" userid="<?=$f_userid?>" ><i class="icon-plus"></i> Thêm</a>
                                            <?php } ?>
                                        </th>
                                    </tr>
                                </thead>
                                <?php
                                if (!empty($a_user_brother)) :
                                    foreach ($a_user_brother as $o_value) {
                                ?>
                                <tbody>
                                    <tr>
                                        <td><?=$o_value->userid?></td>
                                        <td><?=$o_value->saint?> <?=$o_value->username?></td>
                                        <td><?= namhoa_date($o_value->birthday)?></td>
                                        <td>
                                            <?php if (in_array('delete-brother', $a_permission)) { ?>
                                            <a class="btn red-stripe" href="javascript://" onclick="namhoa.single_delete('user_detail_execute.php?action=delete-brother&amp;userid=<?=$f_userid?>&amp;brother_userid=<?=$o_value->userid?>');"><i class="icon-remove icon-white"></i> Xóa</a>
                                            <?php } ?>
                                            <a class="btn blue-stripe" href="user_detail.php?userid=<?=$o_value->userid?>" ><i class="icon-user icon-white"></i> Xem Thông Tin</a>
                                        </td>
                                    </tr>
                                </tbody>
                                <?php }
                                endif;?>
                            </table>
                        </div>
                    </div>
                    <!--tab-pane-->
                    <div class="tab-pane profile-classic" id="diary-info">
                        <div class="portlet-body">
                            <table class="table table-striped table-bordered table-advance table-hover">
                                <thead>
                                    <tr>
                                        <th><i class="icon-bookmark"></i> Khóa</th>
                                        <th><i class="icon-star"></i> Lớp</th>
                                        <th></th>
                                    </tr>
                                </thead>
                                <?php
                                if (!empty($a_user_class)) :
                                    foreach ($a_user_class as $o_value) {

                                        $o_value->classname  = isset($a_Nganh  [$o_value->team ]) ? '   ' . $a_Nganh [$o_value->team ] : '';
                                        $o_value->classname .= isset($a_Cap [$o_value->level]) ? ' - ' . $a_Cap[$o_value->level] : '';
                                        $o_value->classname .= isset($a_Doi  [$o_value->crew ]) ? ' - ' . $a_Doi [$o_value->crew ] : '';
                                ?>
                                <tbody>
                                    <tr>
                                        <td><?=$o_value->course?></td>
                                        <td><?=$o_value->classname?></td>
                                        <td>
                                            <a class="btn green" href="user_detail_diary.php?userid=<?=$f_userid?>&course=<?=$o_value->course?>">
                                                <i class="icon-trophy"></i> Thành Tích
                                            </a>
                                        </td>
                                    </tr>
                                </tbody>
                                <?php }
                                endif;?>
                            </table>
                        </div>
                    </div>
                    <!--tab-pane-->
                    <div id="update-info" class="tab-pane row-fluid profile-account">
                        <div class="row-fluid">
                            <div class="span12">
                                <div class="span3">
                                    <ul class="ver-inline-menu tabbable margin-bottom-10">
                                        <li class="active"><a href="#tab_1-1" data-toggle="tab"><i class="icon-cog"></i> Lý Lịch</a></li>
                                        <li class=""><a href="#tab_2-2" data-toggle="tab"><i class="icon-picture"></i> Ảnh Hồ Sơ</a></li>
                                        <li class=""><a href="#tab_2-3" data-toggle="tab"><i class="icon-lock"></i> Mật Khẩu</a></li>
                                    </ul>
                                </div>
                                <div class="span9">
                                    <div class="tab-content">
                                        <div class="tab-pane active" id="tab_1-1">
                                            <div class="accordion in collapse" id="accordion1-1" style="height: auto;">
                                                <form method="post" id="form-profile" action="user_detail_execute.php?action=update-profile&userid=<?=$f_userid?>" class="horizontal-form">
                                                    <div class="alert alert-error hide">
                                                        <button class="close" data-dismiss="alert"></button>
                                                        Kiểm tra lại thông tin bên dưới.
                                                    </div>
                                                    <div class="row-fluid">
                                                        <div class="span6 ">
                                                            <div class="control-group">
                                                                <label class="control-label" for="saint">Tên Thánh</label>
                                                                <div class="controls">
                                                                    <input type="text" name="saint" id="saint" value="<?=$d_user->saint?>" class="m-wrap span12" placeholder="Giuse">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="span6 ">
                                                            <div class="control-group">
                                                                <label class="control-label" for="username">Họ và Tên <span class="required">*</span></label>
                                                                <div class="controls">
                                                                    <input type="text" name="username" id="username" value="<?=$d_user->username?>" class="m-wrap span12" placeholder="Nguyễn Văn A">
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row-fluid">
                                                        <div class="span6 ">
                                                            <div class="control-group">
                                                                <label class="control-label" >Giới Tính</label>
                                                                <div class="controls">
                                                                    <select name="gender" class="m-wrap span12">
                                                                        <?php foreach ($a_GoiTinh as $v_key => $v_value) { ?>
                                                                            <option <?= $d_user->gender == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                                                                        <?php } ?>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="span6 ">
                                                            <div class="control-group">
                                                                <label class="control-label" for="birthday">Ngày Sinh</label>
                                                                <div class="controls">
                                                                    <input type="text" name="birthday" id="birthday" value="<?=namhoa_date($d_user->birthday)?>" class="m-wrap datepicker span12" placeholder="24-12-0000">
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row-fluid">
                                                        <div class="span4 ">
                                                            <div class="control-group">
                                                                <label class="control-label" for="baptism_date">Rửa Tội</label>
                                                                <div class="controls">
                                                                    <input type="text" name="baptism_date" id="baptism_date" value="<?=namhoa_date($d_user->baptism_date)?>" class="m-wrap datepicker span12" placeholder="24-12-0000">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="span4 ">
                                                            <div class="control-group">
                                                                <label class="control-label" for="eucharist_date">Rước Lễ</label>
                                                                <div class="controls">
                                                                    <input type="text" name="eucharist_date" id="eucharist_date" value="<?=namhoa_date($d_user->eucharist_date)?>" class="m-wrap datepicker span12" placeholder="24-12-0000">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="span4 ">
                                                            <div class="control-group">
                                                                <label class="control-label" for="confirmation_date">Thêm Sức</label>
                                                                <div class="controls">
                                                                    <input type="text" name="confirmation_date" id="confirmation_date" value="<?=namhoa_date($d_user->confirmation_date)?>" class="m-wrap datepicker span12" placeholder="24-12-0000">
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row-fluid">
                                                        <div class="span6 ">
                                                            <div class="control-group">
                                                                <label class="control-label">Phân Loại</label>
                                                                <div class="controls">
                                                                    <select name="usertype" class="m-wrap span12">
                                                                        <?php foreach ($a_Loai_TaiKhoan as $v_key => $v_value) { ?>
                                                                            <option <?= $d_user->usertype == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                                                                        <?php } ?>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="span6 ">
                                                            <div class="control-group">
                                                                <label class="control-label">Phân Ban</label>
                                                                <div class="controls">
                                                                    <?php if(!in_array('set-crew', $a_permission)) : ?>
                                                                    <input type="hidden" name="usercrew" value="<?=$d_user->usercrew?>" />
                                                                    <?php endif; ?>
                                                                    <select name="usercrew" class="m-wrap span12" <?=!in_array('set-crew', $a_permission)? 'disabled="disabled"' : ''?>>
                                                                        <option value=""></option>
                                                                        <?php foreach ($a_PhanBan as $v_key => $v_value) : ?>
                                                                        <option <?= $d_user->usercrew == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                                                                        <?php endforeach; ?>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row-fluid">
                                                        <div class="span12 ">
                                                            <div class="control-group">
                                                                <label class="control-label">Lớp</label>
                                                                <div class="controls">
                                                                    <input type="hidden" name="classid" value="<?=$d_user->classid?>" />
                                                                    <select name="team" class="m-wrap span4">
                                                                        <option value=""></option>
                                                                    <?php foreach ($a_Nganh as $v_key => $v_value) { ?>
                                                                        <option <?= $d_user->team == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                                                                    <?php } ?>
                                                                    </select>
                                                                    <select name="level" class="m-wrap span4">
                                                                        <option value=""></option>
                                                                    <?php foreach ($a_Cap as $v_key => $v_value) { ?>
                                                                        <option <?= $d_user->level == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                                                                    <?php } ?>
                                                                    </select>
                                                                    <select name="crew" class="m-wrap span4">
                                                                        <option value=""></option>
                                                                    <?php foreach ($a_Doi as $v_key => $v_value) { ?>
                                                                        <option <?= $d_user->crew == $v_key ? 'selected="selected"' : '' ?> value="<?= $v_key ?>"><?= $v_value ?></option>
                                                                    <?php } ?>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <h3 class="form-section">Liên Lạc</h3>
                                                    <div class="row-fluid">
                                                        <div class="span4 ">
                                                            <div class="control-group">
                                                                <label class="control-label" for="email">Email</label>
                                                                <div class="controls input-icon">
                                                                    <input type="text" name="email" id="email" value="<?=$d_user->email?>" class="m-wrap span12" placeholder="demo@email.com">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="span4 ">
                                                            <div class="control-group">
                                                                <label class="control-label" for="mobile">ĐTDĐ</label>
                                                                <div class="controls">
                                                                    <input type="text" name="mobile" id="mobile" value="<?=$d_user->mobile?>" class="m-wrap span12" placeholder="093 123 456">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="span4 ">
                                                            <div class="control-group">
                                                                <label class="control-label" for="phone">ĐT Nhà</label>
                                                                <div class="controls">
                                                                    <input type="text" name="phone" id="phone" value="<?= $d_user->phone ?>" class="m-wrap span12" placeholder="39 123 456">
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row-fluid">
                                                        <div class="span12 ">
                                                            <div class="control-group">
                                                                <label class="control-label" for="address">Địa Chỉ</label>
                                                                <div class="controls">
                                                                    <input type="text" name="address" id="address" value="<?=$d_user->address?>" class="m-wrap span12" placeholder="123 Tên Đường, Phường, Quận" />
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="row-fluid">
                                                        <div class="span12 ">
                                                            <div class="control-group">
                                                                <label class="control-label" for="note" >Ghi Chú</label>
                                                                <div class="controls">
                                                                    <textarea rows="3" name="note" id="note" value="<?=$d_user->note?>" class="span12 m-wrap"></textarea>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="form-actions">
                                                        <?php if (in_array('update-profile', $a_permission)) { ?>
                                                        <button type="submit" class="btn green"><i class="icon-ok"></i> Lưu</button>
                                                        <?php } ?>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                        <div class="tab-pane" id="tab_2-2">
                                            <div class="accordion collapse in" id="accordion2-2" style="height: auto;">
                                                <form method="post" action="user_detail_execute.php?action=update-profile-image&userid=<?=$f_userid?>" enctype="multipart/form-data">
                                                    <p>Chọn ảnh trong thiết bị để cập nhật ảnh đại diện</p>
                                                    <div class="space10"></div>
                                                    <div data-provides="fileupload" class="fileupload fileupload-new">
                                                        <div class="input-append">
                                                            <div class="uneditable-input">
                                                                <i class="icon-file fileupload-exists"></i> 
                                                                <span class="fileupload-preview"></span>
                                                            </div>
                                                            <span class="btn btn-file">
                                                                <span class="fileupload-new">Chọn Ảnh</span>
                                                                <span class="fileupload-exists">Thay Ảnh</span>
                                                                <input type="file" name="file" class="default">
                                                            </span>
                                                            <a data-dismiss="fileupload" class="btn red fileupload-exists" href="#">Xóa</a>
                                                        </div>
                                                    </div>
                                                    <div class="clearfix"></div>
                                                    <div class="controls">
                                                        <span class="label label-important">Chú Ý!</span>
                                                        <span>Hình ảnh phải thể hiện rõ khuôn mặt chủ thể</span>
                                                    </div>
                                                    <div class="space10"></div>
                                                    <img src="user_image.php?action=download-image&userid=<?=$f_userid?>"/>
                                                    <div class="space10"></div>
                                                    <div class="form-actions">
                                                        <?php if (in_array('update-profile-image', $a_permission)) { ?>
                                                        <button type="submit" class="btn green"><i class="icon-ok"></i> Lưu</button>
                                                        <?php } ?>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                        <div class="tab-pane" id="tab_2-3">
                                            <div class="accordion collapse in" id="accordion3-3" style="height: auto;">
                                                <form id="form-password" action="user_detail_execute.php?action=update-password&userid=<?=$f_userid?>" method="post">
                                                    <div class="alert alert-error hide">
                                                        <button class="close" data-dismiss="alert"></button>
                                                        Kiểm tra lại thông tin bên dưới.
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="passwd">Mật Khẩu Hiện Tại <span class="required">*</span></label>
                                                        <div class="controls">
                                                            <input type="password" name="passwd" id="passwd" autocomplete="off" class="m-wrap span12">
                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="newpasswd">Mật Khẩu Mới <span class="required">*</span></label>
                                                        <div class="controls">
                                                            <input type="password" name="newpasswd" id="newpasswd" autocomplete="off" class="m-wrap span12">
                                                        </div>
                                                    </div>
                                                    <div class="control-group">
                                                        <label class="control-label" for="retypepasswd">Nhập Lại Mật Khẩu Mới <span class="required">*</span></label>
                                                        <div class="controls">
                                                            <input type="password" name="retypepasswd" id="retypepasswd" autocomplete="off" class="m-wrap span12">
                                                        </div>
                                                    </div>
                                                    <div class="clearfix"></div>
                                                    <div class="space10"></div>
                                                    <div class="controls">
                                                        <span class="label label-important">Chú Ý!</span>
                                                        <span>Mật Khẩu phải có tối thiểu <strong>6 ký tự</strong>, và phải chứa ký tự số <strong>0-9</strong> và chữ cái <strong>a-Z</strong></span>
                                                    </div>
                                                    <div class="form-actions">
                                                        <?php if (in_array('update-password', $a_permission)) { ?>
                                                        <button type="submit" class="btn green"><i class="icon-ok"></i> Lưu</button>
                                                        <?php } ?>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php include 'lib_tail.php'; ?>